package com.gientech.work.demo.springboot.bean;

import com.ctrip.framework.apollo.spring.events.ApolloConfigChangeEvent;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.context.ApplicationListener;

public class DemoApplicationListener implements ApplicationListener<ApolloConfigChangeEvent> {
  private static final Logger logger = LoggerFactory.getLogger(DemoApplicationListener.class);

//  @Override
  public void onApplicationEvent(ApolloConfigChangeEvent apolloConfigChangeEvent) {
    logger.info("ApolloConfigChangeEvent received, namespace: {}",
        apolloConfigChangeEvent.getConfigChangeEvent().getNamespace());

    logger.info("ApolloConfigChangeEvent received, changevalue:" + apolloConfigChangeEvent.getConfigChangeEvent().getChange("key01").getNewValue().toString());

  }
}
